<?php

namespace App\Http\Controllers;

use App\Article;
use Illuminate\Http\Request;

class ArticleController extends Controller
{
    public function index(){
        $data = Article::all();
        return json_decode(json_encode($data),true);
    }

    public function detail(Request $request){
        $params = $request->input();
        $data = Article::where('id',$params['id'])->get();
        return json_decode(json_encode($data),true);
    }
}
